#ifndef FULLSTATE_H
#define FULLSTATE_H

//full state for beginning

#include <boost/regex.hpp>
#include "Ball.h"
#include "Player.h"
#include <string>
#include <vector>
#include <QMutex>

using namespace std;
using namespace boost;

class FullState
{
    int timeStep;
    Ball ball;
    //vector<Player> leftTeam;
    //vector<Player> rightTeam;   //uninumber - 1 indexek

    Player teams[2][11];

    string playMode;

    static const string PLAYMODE_REGEX;
    static const string REAL_NP_REGEX;
    static const string BALL_REGEX;
    static const string PLAYER_REGEX;
    static const string TIME_STEP_REGEX;

public:
    QMutex mutex;

    static FullState & instance();

    //mutex!
    void parse(string);

    int getTimeStep() { return timeStep; }
    Ball getBall() { return ball; }
    Player getPlayer(int side, int index) { return teams[side][index - 1]; }
    string getPlayMode() { return playMode; }

    int getmTimeStep() { mutex.lock(); int _timeStep = timeStep; mutex.unlock(); return _timeStep; }
    Ball getmBall() { mutex.lock(); Ball _ball = ball; mutex.unlock(); return _ball; }
    Player getmPlayer(int side, int index) { mutex.lock();  Player _player = teams[side][index - 1]; mutex.unlock(); return _player;  }
    string getmPlayMode() { mutex.lock(); string _playMode = playMode; mutex.unlock(); return _playMode; }
};

#endif // FULLSTATE_H
